/*
 * @lc app=leetcode.cn id=415 lang=javascript
 *
 * [415] 字符串相加
 */

// @lc code=start
/**
 * @param {string} num1
 * @param {string} num2
 * @return {string}
 */
var addStrings = function(num1, num2) {
    let len1=num1.length
    let len2=num2.length
    let add=0
    let ans=""
    let len=Math.max(len1,len2)
    while(num1.length<len){
        num1=0+num1
    }
    while(num2.length<len){
        num2=0+num2
    }
    for(let i=len-1;i>=0;i--){
        let temp=+num1[i]+(+num2[i])+add
        add=0
        if(temp>=10){temp=temp-10 ;add++}
        ans=temp+ans
    }
    if(add){return add+ans}
    return ans
};
// @lc code=end

